Addition
+
Used to add two operands
Subtraction
–
Used to subtract the second operand from the
first
Multiplication
*
Used to multiply both operands
Division
/
Used
to
divide
the
numerator
by
the
denominator
Modulus
%
Gives the remainder after the integer division
Increment
++
Increases the integer value by one
Decrement
—
Decreases the integer value by one
Table 2.1: Arithmetic Operators
Refer to the following code:
// SPDX-License-Identifier: Some Identifier
pragma solidity ^0.8.10;
contract ArithmeticContract {
uint a = 10;
uint b = 2;
function addition() public view returns(uint) {
return a + b;
}
function subtraction() public view returns(uint) {
return a - b;
}
function multiplication() public view returns(uint) {
return a * b;
}
function division() public view returns(uint) {
return a / b;
}
function modulus() public view returns(uint) {